//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#include "StatisticsCollector.h"

void StatisticsCollector :: initialize(){
	receivedDataPackets= 0;
	lastPacketArrival=0;
}

void StatisticsCollector::handleMessage(cMessage *msg){}

void StatisticsCollector::finish(){
		EV << "Received: " << receivedDataPackets << endl;
	    EV << "Data packets arrived, Min:    " << data.getMin() << endl;
	    EV << "Data packets arrived, Max:    " << data.getMax() << endl;
	    EV << "Data packets arrived, Mean:   " << data.getMean() << endl;
	    EV << "Data packets arrived, Variance: " << data.getVariance() << endl;
	    EV<<  "Mean Staying Time:"<< staying.getMean()<<endl;
	    EV<<  "Variance Staying Time:"<< staying.getVariance()<<endl;
	    EV<<  "Min Staying Time:"<< staying.getMin()<<endl;
	    EV<<  "Max Staying Time:"<< staying.getMax()<<endl;

	    recordScalar("#received", receivedDataPackets);
	    staying.recordAs("Staying Time");
	    data.recordAs("Data packets");


}
